package com.aaronprj.common.entities.mbooks;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

@Entity
public class OrderItem{
	private int id;

	private BookItem item;
	private int units;
	private double totalPrice;
	private BookOrder bookOrder;


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getUnits() {
		return units;
	}

	public void setUnits(int units) {
		this.units = units;
	}
	
	@OneToOne(cascade = { CascadeType.REFRESH})
	public BookItem getItem() {
		return item;
	}

	public void setItem(BookItem item) {
		this.item = item;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@JoinColumn(name = "bookorder_id")
	public BookOrder getBookOrder() {
		return bookOrder;
	}

	public void setBookOrder(BookOrder bookOrder) {
		this.bookOrder = bookOrder;
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}




}
